package com.iapplize.gcm.test;

import android.app.Activity;
import android.app.AlertDialog;
import android.app.NotificationManager;
import android.content.Context;
import android.content.DialogInterface;
import android.os.Bundle;

public class PushAlertActivity extends Activity {

	String message = "";
	
	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);

		setContentView(R.layout.main_popup);
		
		
		

		Bundle extras = getIntent().getExtras();

		if (extras != null) {

			message = extras.getString("message");
		}

		try {
			AlertDialog alertDialog = new AlertDialog.Builder(this).create();

			alertDialog.setTitle(getString(R.string.app_name));
			alertDialog.setCancelable(false);
			alertDialog.setMessage(message);

			alertDialog.setButton(AlertDialog.BUTTON_POSITIVE,
					getString(R.string.OK),
					new DialogInterface.OnClickListener() {

						public void onClick(DialogInterface dialog, int id) {

							String ns = Context.NOTIFICATION_SERVICE;
							NotificationManager mNotificationManager = (NotificationManager) getSystemService(ns);
							mNotificationManager.cancel(1);
							
							dialog.cancel();

							finish();

						}
					});

			alertDialog.show();
		} catch (Exception e) {
			// TODO: handle exception
		}

	}

}
